#!/usr/bin/env io
################################################################################
# You may also use /usr/bin/env osxvm, if you got Io via MacPorts. If you did
# go the MacPorts route, you're missing out on the "full" Io experience though.
#

//
// YourSpace, in Io!
// http://iolanguage.com/
//

YourSpace := Object clone do(

    urlBase := "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid="

    userName := "augustindecember"
    userID   := "367485763" //and a method to GET that number
    
    
    pullThis := ( urlBase .. userID )
    
    fetchHTML := method(
        
        // open a connection to the pullThis URL
        "fetching..." println
        aString := URL with( pullThis ) fetch
        //links := aString asXML elementsWithName("a") map(attributes at("href"))
        "" println
        aString print
        "" println
    )
    
    diceHTML := method(
    
        // dice it up into strings we want
        "dicing..." println
        
    )
    
    presentOutput := method(
    
        // format presentation
        "presenting..." println
        
    )
    
    goGo := method(
    
        // run everything, like a main() kinda.
        
        "" println
        "YourSpace.io: Version 0.0.1a" println
        
        self fetchHTML()
        self diceHTML()
        self presentOutput()
        
        self tempMsg()
        
    )
    
    tempMsg := method( // because it isn't yet done...
        "" println
        "YourSpace CLI: Io Variant... Not yet (fully) implemented." println
        ("Link to " .. userName .. ": " .. pullThis) println
        "" println
    )
    
)

// advanced tasks:
// - read the ~/.yourspace/ files
// - write the ~/.yourspace/ files

// Run it:
YourSpace goGo
